<template>
  <div>
    <div id="box">
      <!-- 最顶端部分 -->
      <v-header title="商品搜索" :back="true"></v-header>
      <!-- 导航部分 -->
      <div id="daohang">
        <van-search v-model="value" placeholder="笔记本" @keydown.enter="enter" class="in1"/>
      </div>
      <!-- 内容部分 -->
      <div id="neirong">
        <div v-if="arr.length==0">
          <h3>~~暂无数据~~</h3>
        </div>
        <ul>
          <li v-for="item in arr" :Key="item.id">
            <img :src="'http://localhost:3000'+item.img" alt="" />
            <div class="pp">
              <p class="p1">{{item.goodsname}}</p>
              <p class="p2">敏感肌控油，祛痘去写，男女可用用用用用用用用用</p>
              <p class="p3">
                <em>￥</em><span>{{item.price}}</span><del>￥{{item.market_price}}</del><i>999人已付款</i>
              </p>
              <span class="p4">11.11限时299元起</span>
              <p class="p5"><span>999条评论</span><em>99%好评</em></p>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios"
export default {
  data(){
    return{
      value:"",
      arr:[]
    }
  },
  methods:{
    enter() {
    this.$router.push("/sousuo?id=" +this.value);
    }
  },
  mounted(){
    axios({
      url:"/api/search",
      method:"get",
      params:{
          keywords:this.$route.query.id
      }
    }).then((res)=>{
      console.log(res);
      this.arr=res.data.list
    })
  }
};
</script>

<style scoped>
.van-search{
  background: rgba(0,0,0,0);
}
.van-search__content{
  height: auto !important;
}
/* 导航部分*/
#daohang {
  background: linear-gradient(#ff6040, #ff8273);
  height: 1rem;
}

#daohang .in1 {
  width: 6.8rem;
  height: 0.6rem;
  line-height: 0.6rem;
  margin-left: 0.3rem;
}
.van-search__content{
    width: 7rem;
    height: 0.6rem;
     line-height: 0.6rem;
    border-radius: 0.1rem;
}
.van-cell{
  height: 0.6rem;
  line-height: 0.6rem;
}

/*内容部分*/
#neirong {
  width: 7.1rem;
  margin: auto;
  margin-top: 0.35rem;
  flex: 1;
  overflow: auto;
}
#neirong ul li {
  display: flex;
  justify-content: space-between;
  height: 3rem;
}
#neirong ul li img {
  width: 2.16rem;
  height: 2.18rem;
}
#neirong ul li .pp {
  width: 4.5rem;
  height: 2.18rem;
}
#neirong ul li .pp .p1 {
  font-size: 0.3rem;
  color: #333;
  width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#neirong ul li .pp .p2 {
  font-size: 0.26rem;
  color: #9b9b9b;
  width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#neirong ul li .pp .p3 {
  margin-top: 0.15rem;
  margin-bottom: 0.1rem;
}
#neirong ul li .pp .p3 em {
  font-size: 0.12rem;
  color: #ff6040;
}
#neirong ul li .pp .p3 span {
  font-size: 0.32rem;
  color: #ff6040;
  font-weight: bold;
  margin-right: 0.1rem;
}
#neirong ul li .pp .p3 del {
  font-size: 0.12rem;
  color: #999999;
  margin-right: 0.2rem;
}
#neirong ul li .pp .p3 i {
  font-size: 0.14rem;
  color: #b2b2b2;
}
#neirong ul li .pp .p4 {
  background: #ff8066;
  color: #ffe3dd;
  padding: 0.06rem;
}
#neirong ul li .pp .p5 {
  font-size: 0.18rem;
  color: #9b9b9b;
  margin-top: 0.2rem;
}
#neirong ul li .pp .p5 span {
  margin-right: 0.2rem;
}
</style>